﻿<%template _header%>
<%namespace YouHP.Model%>
<!--header end-->
<style>
.msg_table
{
	text-align:center;
}
.msg_table table
{
	margin:0 auto;
}
.msg_table th
{
	text-align:right;
	vertical-align:top;
	padding:5px;
	width:60px;
}

.receiver_input
{
	border:1px solid #808080;
}
.receiver_input .f_button
{
	float:right;
margin:3px 2px 0 0;
padding:3px 2px 0 0;
position:relative;
}
.msg_table td
{
	vertical-align:top;
	padding:5px;
	width:500px;
}
.msg_table .title
{
	font-weight:bold;
	font-size:14px;
	 margin-bottom:20px;
	 text-align:left;
}
.myfriendlist {
background:#FFFFFF none repeat scroll 0 0;
border:1px solid #98B1C8;
padding:2px;
position:absolute;
right:-3px;
top:25px;
}
.myfriendlist .myfriendlist_bar
{
	background:#F2F6FB none repeat scroll 0 0;
border-bottom:1px solid #EEEEEE;
color:#000000;
height:20px;
padding:2px 5px;

}

.myfriendlist .myfriendlist_lst
{
	height:150px;
	padding:2px;
}
.myfriendlist .myfriendlist_bottom
{
	padding:5px;
}
.myfriendlist .item
{
	width:120px;
	float:left;
	margin-bottom:3px;
}
.myfriendlist_bottom a
{
	color:Green!important;
	text-decoration:underline;
	font-size:14px!important;
}
</style>

<script type="text/javascript">
    function showdiv()
    {
    
      _$("receivers").value = "";
      var e = _$('myfriendlist').style.display;
      if(e == 'none')
      {
          _$('myfriendlist').style.display = 'block';
          _$('extend_icon').src="/support/alpha/images/xx_xs1.gif";
          _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xs1.gif';"
          _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xs2.gif'"
      }
      else
      {
          _$('myfriendlist').style.display = 'none';
          _$('extend_icon').src="/support/alpha/images/xx_xx1.gif";
          _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xx1.gif';"
          _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"
      }
    }
 

	function flist_submit()
	{
	
        var name_array=[];
        var form = _$('postpm');
        var j = 0;
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox")
          {
             if(e.checked == true)
             {
                 name_array[j] = e.value;
                 j++;
             }
          }
        }   
        for( var k = 0;k < name_array.length;k++)
        {
            if(k == name_array.length-1)
               _$("receivers").value += name_array[k];
            else
               _$("receivers").value += name_array[k] + ";";
        }
       
        _$('myfriendlist').style.display = 'none';
        _$('extend_icon').src="/support/alpha/images/xx_xx1.gif";
        _$('extend_icon').onmouseout="this.src='/support/alpha/images/xx_xx1.gif';"
        _$('extend_icon').onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"

	}
	function selectall()
	{
	    var form = _$('postpm');
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox" && e.checked == false)
          {
             e.checked = true;
               
          }
        }   	
	}

	function cancellall()
	{
	    var form = _$('postpm');
        for(var i = 0;i < form.elements.length;i++)
        {
          var e = form.elements[i];
          if(e.name == "checkbox" && e.checked == true)
          {
             e.checked = false;
               
          }
        }   
	}
	function dataPost()
	{
	    var e = _$("receivers").value;
	    var s = _$("message").value;
	    if(e == "" || e == _$("receivers").defaultValue)
	    {
	       alert("接收人不能为空！");
	       return;
	    }
	    if(s == "")
	    {
	       alert("内容不能为空！");
	       return;
	    }
	       _$("postpm").submit();
	}

</script>
<!--主体-->
<div class="layout-cols2">
<%template _memmenu%>

<div class="pannelcontent">

	<div class="pcontent">
	   <div  class="panneldetail">
		<%template _mempmenu%>
			<div class="pannelbody">
			
                <%if IsPost%>
                <%template _msgbox%>
                <%else%>
              <div class="msg_table">
                    <div class="title">发送短消息(私密对话)</div>
						<form id="postpm" name="postpm" method="post" action="">
						
						<table>
						<tr>
							<th>收件人:</th>
							<td>
							<div class="receiver_input">
	
							<div  class="f_button">
							    <div onclick="showdiv();">
							    <img  id="extend_icon" src="/support/alpha/images/xx_xx1.gif" style="cursor:pointer;" onmouseout="this.src='/support/alpha/images/xx_xx1.gif';" onmouseover="this.src='/support/alpha/images/xx_xx2.gif'"; />
							    </div>
							    <div id="myfriendlist" class="myfriendlist" style="display:none; width:400px;">
                                    <div class="myfriendlist_bar">请选择发送对象</div>
                                  
                                    <div id="flist" class="myfriendlist_lst" style="overflow-y: scroll; overflow-x: scroll;">
                                    <%csharp%>
                                    int i=0;
                                    foreach(UserInfo item in FriendList){
                                    <%/csharp%>
                                    <%csharp%>if(i>0 && i%3==0){<%/csharp%>
                                    <div style="clear:both;"></div>
                                    <%csharp%> }<%/csharp%>
                                    <div class="item"><input name="checkbox" id="chekbox_{i}" type="checkbox" value="{item.UserName}" />&nbsp;<font style="color:Green;">{item.UserName}</font></div>
                                  
  
                                    <%csharp%> i++;}<%/csharp%>
                                    </div>
                              
                                    <div class="myfriendlist_bottom"><a href="javascript:" onclick="selectall();">全选</a>&nbsp;<a href="javascript:" onclick="cancellall();">全不选</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="button" onclick="flist_submit();"  title="确定" value="确定" id="btn_qd"/>&nbsp;
                                    <input type="button" onclick="_$('myfriendlist').style.display='none';"  title="关闭" value="关闭" id="btn_gb"/>&nbsp;
                                    </div>
                               </div>
							    
							</div>
							<div style=" height:23px;">
							<input name="receivers" id="receivers" type="text" style="color:#aaa;border:0 none;"  size="40" value="请输入用户名，并用分号隔开" onfocus="OnEnter(this);" onblur="OnExit(this);" />
					        </div>
	                          
                            </div>

							</td>
						</tr>
						<tr>
							<th>内容:</th>
							<td><textarea name="message" id="message" style="width:500px; height:300px;"></textarea></td>
						</tr>
			
                        <tr>
							<td colspan ="2" align ="right">
							 <span  onmouseout="this.className='new_sbt'" onmouseover="this.className='new_sbt_h'" onclick="dataPost();" class="new_sbt" id="submitbutton">发送</span>
							</td>
						</tr>
						</table>
							
						</form>
              </div>	
						
		        <%/if%>
		    </div>    
		</div>
	</div>

</div>

</div>
<!--主体-->

<%template _footer%>
